﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using blackhouse.Data;

namespace blackhouse.BlackApart.Data.Sql {
    public class MailTemplateDataAccess : AdoMailTemplateDataAccess {

        #region Fields

        private string connectionString;
        private MsSqlAdoDataHelper dataHelper;

        #endregion

        #region Constructors

        public MailTemplateDataAccess(string sqlConnectionString) {
            this.connectionString = sqlConnectionString;
            this.dataHelper = new MsSqlAdoDataHelper(this.connectionString);
            SqlVersioning versioning = new SqlVersioning(this.connectionString, this.GetType().Assembly);
        }

        #endregion

        #region AdoMailTemplateDataAccess

        public override IDataReader GetReaderForMailTemplate(int templateId, string language) {
            this.dataHelper.Reset();
            this.dataHelper.ProcedureName = "bhp_MailTemplateGet";
            this.dataHelper.AddParameter("TemplateId", templateId, DbType.Int32);
			this.dataHelper.AddParameter("Language", language, DbType.StringFixedLength, 5);
            return this.dataHelper.Execute();
        }

        public override IDataReader GetReaderForReservationStatusTemplates() {
            this.dataHelper.Reset();
            this.dataHelper.ProcedureName = "bhp_MailTemplateGetForReservationStatus";
            return this.dataHelper.Execute();
        }

        #endregion

    }
}
